<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<link href="./css/ltcss.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PayChannel</title>
<link href="styles/general.css" rel="stylesheet" type="text/css">
<link href="styles/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery/uploadify/jquery.min.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/validator.js"></script>
<style type="text/css">
	lable1 {
		text-align: center;
	    vertical-align: middle;
	    font-weight: bold;
	    padding: 5px 1em;
	}
</style>
<script language="javascript" type="text/javascript" src="js/DatePicker4.72/WdatePicker.js"></script>

    <script type="text/javascript">
function txcheck(type){
	
	return formvalidator("all");
}
function formvalidator(obj)
{
	var controlId = "all";
	 if (typeof(obj) != "string" )
	 {
		 controlId = obj.id;
	 }
	if(controlId=="all" || controlId=="model.code")
	{
		if(Utils.trim(document.getElementById("model.code").value)=="")
		{
			document.getElementById("CompareValidator1").style.visibility="visible";
			return false;
		}
		else
		{
			if(controlId!="all")
				checkcode();
			document.getElementById("CompareValidator1").style.visibility="hidden";
		}
	}
	if(controlId=="all" || controlId=="model.pointofbillingname")
	{
		if(Utils.trim(document.getElementById("model.pointofbillingname").value)=="")
		{
			document.getElementById("CompareValidator2").style.visibility="visible";
			return false;
		}
		else
		{
			document.getElementById("CompareValidator2").style.visibility="hidden";
		}
	}
	if(controlId=="all" || controlId=="model.fee")
	{
		if(Utils.trim(document.getElementById("model.fee").value)=="")
		{
			document.getElementById("CompareValidator3").style.visibility="visible";
			return false;
		}
		else
		{
			document.getElementById("CompareValidator3").style.visibility="hidden";
		}
	}
	return true;
}
function checkcode()
{
	var code = document.getElementById("model.code").value;
	var appn = document.getElementById("appinfo.appnumber").value;
	
	if(Utils.trim(code)!="")
	{
		$.get("apppointofbilling_checkcode.do?model.code="+code+"&model.appnumber="+appn, 
          function(data) 
          { 
           	  if(data=="0")
           	  {
               	document.getElementById("CompareValidator4").style.visibility="hidden";
           	  }else
           	  {
           			document.getElementById("CompareValidator4").style.visibility="visible";
           	  }
          });
	}
}

function manage_sp_checkallprovince(obj)
{
	var ckbs = document.getElementsByName("ckb_province");
	if (obj.checked == true)
	{
		for (var n = 0; n < ckbs.length; n++)
		{
			ckbs[n].checked = true;
			document.getElementById("tr_terrace_" + ckbs[n].value).style.display = "block";			
		}
	}
	else
	{
		for (var n = 0; n < ckbs.length; n++)
		{	
			ckbs[n].checked = false;
			document.getElementById("tr_terrace_" + ckbs[n].value).style.display = "none";			
		}
	}
}

function ckbox(obj){	
	if(obj.checked) {
		//document.getElementById("tr_terrace_" + obj.value).style.display = "block";
		document.getElementById("tr_terrace_" + obj.value).removeAttribute("style");
	}
	else {
		document.getElementById("tr_terrace_" + obj.value).style.display = "none";
	}
}
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="apppointofbilling_save.do?type=<s:property value="type" />" onsubmit="return txcheck('<s:property value="type" />');">
 			<input type="hidden" name="appinfo.appnumber" id="appinfo.appnumber" value="<s:property value="appinfo.appnumber"/>"/>
             <input type="hidden" name="model.id" id="model.id" value="<s:property value="model.id"/>"/>
             <input type="hidden" name="model.cpid" id="model.cpid" value="<s:property value="model.cpid"/>"/>
              <input type="hidden" name="model.appnumber" id="model.appnumber" value="<s:property value="model.appnumber"/>"/>
              <input type="hidden" name="model.createuser" id="model.createuser" value="<s:property value="model.createuser"/>"/>
             <input type="hidden" name="model.createdate" id="model.createdate" value="<s:property value="model.createdate"/>"/>
                               
             <input type="hidden" id="cpid" name="cpid" value="<s:property value="cpid"/>"/>
             <input type="hidden" id="categoryparentid" name="categoryparentid" value="<s:property value="categoryparentid"/>"/>
             <input type="hidden" id="appName" name="appName" value="<s:property value="appName"/>"/>
 <h1>
        <span class="action-span"><a href="apppointofbilling_list.do?appinfo.appnumber=<s:property value="appinfo.appnumber"/>&cpid=<s:property value="cpid"/>&categoryparentid=<s:property value="categoryparentid"/>&appName=<s:property value="appName"/>">计费点列表</a></span> <span
            class="action-span1"><a href="">
                首页</a> </span><span id="search_id" class="action-span1">- 计费点管理 </span>
        <div style="clear: both">
        </div>
    </h1>
 <div style="margin-bottom: 5px;" class="list-div">
        <table width="100%" cellspacing="1" cellpadding="3">
            <tbody>
                <tr>
                    <th colspan="2">
                        基本信息
                    </th>
                </tr>
                <tr> 
				    <td  class="label"><div align="right">计费点入口：</div></td> 
				    <td>
				    <select id="model.entryid" name="model.entryid">
				    	<option value="0">--请选择--</option>
				    <s:iterator value="entrylist">
				    	<option <s:if test="id==model.entryid">selected</s:if> value="<s:property value="id"/>"><s:property value="entrycode"/>|<s:property value="triggerremark"/></option>
				    </s:iterator>
				    </select>
                    </td>
				  </tr>
                <tr> 
				    <td  class="label"><div align="right">计费点代码：</div></td> 
				    <td>
          					<input id="model.code" name="model.code" type="text" size="20" maxlength="4" 
          					value="<s:property value="model.code" />" onblur="formvalidator(this)" <s:if test="!type.equals('insert')">readonly="readonly"</s:if>/>
						<span
                           class="require-field">*</span>建议3位数字，如001.&nbsp;
                        <span id="CompareValidator1" style="color:Red;visibility:hidden;">不能为空</span><span id="CompareValidator4" style="color:Red;visibility:hidden;">code已存在</span><br />
                    </td>
				  </tr>
				 <tr> 
				    <td class="label"><div align="right">计费点名称：</div></td> 
				    <td >
					    <input type="text" size="20" name="model.pointofbillingname" id="model.pointofbillingname"
					    value="<s:property value="model.pointofbillingname"/>"  onblur="formvalidator(this)"/>
					    <span
                           class="require-field">*</span>&nbsp;
                        <span id="CompareValidator2" style="color:Red;visibility:hidden;">不能为空</span><br />
                    </td>
				  </tr>
				  <tr> 
				    <td class="label"><div align="right">计费点资费：</div></td> 
				    <td >
					    <input type="text" size="20" name="model.fee" id="model.fee"
					    value="<s:property value="model.fee"/>"  onblur="formvalidator(this)"/>
					    <span
                           class="require-field">*</span>&nbsp;
                        <span id="CompareValidator3" style="color:Red;visibility:hidden;">不能为空</span><br />
                    </td>
				  </tr>
				  <tr>
					<td class="label"><div align="right">类型：</div></td> 
				    <td >
					    <input type="radio" size="20" name="model.type" id="model.type.0" value="0" <s:if test='"0".equals(model.type)'>checked</s:if> />单次计费
					    <input type="radio" size="20" name="model.type" id="model.type.1" value="1" <s:if test='"1".equals(model.type)||"".equals(model.type)'>checked</s:if> />重复计费
					    &nbsp;&nbsp;<font color="red">(单次计费：是指一次性购买道具,以后用到不需要重复购买；重复计费：是指可以多次购买的道具)</font>
                    </td>
				  </tr>
				  <tr> 
				    <td class="label"><div align="right">触发计费说明：</div></td> 
				    <td >
					   <textarea name="model.triggerremark" id="model.triggerremark" rows="6" cols="60"><s:property value="model.triggerremark" /></textarea>
                    </td>
				  </tr>
				  <tr> 
				    <td class="label"><div align="right">道具功能：</div></td> 
				    <td >
					   <textarea name="model.propremark" id="model.propremark" rows="6" cols="60"><s:property value="model.propremark" /></textarea>
                    </td>
				  </tr>
				  <!--tr>
				
		            <td class="label">&nbsp;<font color="red">(*)</font>开通平台：<input type="checkbox" onclick="manage_sp_checkallprovince(this);" /></td>		      		
		      		<td class="label" colspan="2">
		      		<div class="list-div">
			      		<table width="100%" border="0" cellspacing="0" cellpadding="0" >
			      			<tr style="visibility: true">			      				
	      					<s:iterator value="terraceNameList" status="tn">
	      						<s:if test="#tn.index>0&&#tn.index%5==0"></tr><tr></s:if>
				    			 <td width="10%" class="table_w2" align="left">&nbsp;&nbsp;
				    			 <input type="checkbox" onclick="ckbox(this);"  name="ckb_province" value="<s:property value="id" />" 
				    			<s:if test="terraceIds.indexOf(','+id+',')!=-1">checked</s:if> >&nbsp;<s:property value="operatorsName"/></td>						    			 
				 			</s:iterator>						 		
						  </tr>
			      		</table>
		      		</div>
		      		<div class="list-div">
		      			<table id="mytb" width="100%" style="display: block;"  cellspacing="2" cellpadding="2" >
		        			<tr style="width: 100%;">
						    		<td class="lable1" width="30%" align="center">平台名称：</td> 
					    			<td class="lable1" width="30%" align="center">计费代码：</td>
							    	<td class="lable1" width="40%" align="center">描述：</td> 
				    		</tr>
		        			<s:iterator value="terracelist" status="t">
					    		<tr id="tr_terrace_<s:property value="terraceId" />" <s:if test="terraceIds.indexOf(','+terraceId+',')==-1"> style="display: none;"</s:if> style="width: 100%;">
				   					<td class="lable1" width="30%" align="center">
				   						<s:property value="operatorsName" />
				   						<input type="hidden" name="appPointTerraceInfos[<s:property value="#t.index" />].id" value="<s:property value="id" />" />
				   					    <input type="hidden" name="appPointTerraceInfos[<s:property value="#t.index" />].apppointId" value="<s:property value="model.id" />" />
				   					    <input type="hidden" name="appPointTerraceInfos[<s:property value="#t.index" />].terraceId" value="<s:property value="terraceId" />" />
				   					</td>
			       					<td class="lable1" width="30%" align="center">
					   					<input id="relevanceid" name="appPointTerraceInfos[<s:property value="#t.index" />].relevanceid" type="text" value="<s:property value="relevanceid" />" /> </td>
					   				<td class="lable1" width="40%" align="center">
									   <textarea id="glremark" name="appPointTerraceInfos[<s:property value="#t.index" />].glremark" rows="2" style="width: 90%;">
									      <s:property value="glremark" /> 
									   </textarea>
					        		</td>
					    		</tr>
				    		</s:iterator>
						</table>
						</div>
		      		</td>
	      		</tr-->
				  <tr> 
				    <td class="label"><div align="right">描述：</div></td> 
				    <td >
					   <textarea name="model.remark" id="model.remark" rows="6" cols="60"><s:property value="model.remark" /></textarea>
                    </td>
				  </tr>			 
				  <tr>
                    <td colspan="2" align="center">
                     <s:if test="isUpdate.equals('true')">
					    <input type="submit" value=" 确定 " class="button" />
                        &nbsp;&nbsp;&nbsp;
                        <input type="reset" value=" 重置 " class="button" />
                         </s:if>
                    </td>
                    
                </tr>
	 	</tbody>
	 </table>
 </div>
</form>
 <!--Bottom开始-->
    
<div id="footer">
<br />
<s:property value="bottom"/></div>
    <!--Bottom结束-->
  
</body>
</html>